package com.offcn.controller;

import com.offcn.pojo.Account;
import com.offcn.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class ListController {

    @Autowired
    private AccountService accountService;

    @GetMapping("list")
    public String list(Model model){
        List<Account> accountList = accountService.findAccount();
        model.addAttribute("accountList",accountList);
        return "account-list";
    }

    @GetMapping("users")
    public String toList(Model model) {
        List<Account> list = accountService.findAccount();
        model.addAttribute("list", list);
        return "user-list";
    }
}
